/*
 Navicat Premium Data Transfer

 Source Server         : 虚拟机oracle
 Source Server Type    : Oracle
 Source Server Version : 110200
 Source Host           : 192.168.199.183:1521
 Source Schema         : SYSTEM

 Target Server Type    : Oracle
 Target Server Version : 110200
 File Encoding         : 65001

 Date: 04/12/2021 15:21:27
*/


-- ----------------------------
-- Table structure for T_USER
-- ----------------------------
DROP TABLE CT.T_USER;
CREATE TABLE CT.T_USER (
  "USERID" NUMBER NOT NULL,
  "USERNAME" VARCHAR2(254 BYTE) NOT NULL,
  "USERPASSWORD" VARCHAR2(254 BYTE) NOT NULL,
  "ISADMIN" NUMBER NOT NULL
)
;

-- ----------------------------
-- Records of T_USER
-- ----------------------------
INSERT INTO CT.T_USER VALUES ('1', 'admin', 'admin', '1');
INSERT INTO CT.T_USER VALUES ('2', '李明', '123456', '0');
INSERT INTO CT.T_USER VALUES ('11', 'zhang', '123', '0');
INSERT INTO CT.T_USER VALUES ('13', 'zhao', 'abc', '1');
INSERT INTO CT.T_USER VALUES ('14', 'wangpeng', '123456', '0');
INSERT INTO CT.T_USER VALUES ('15', 'wp123', 'wp456', '1');
INSERT INTO CT.T_USER VALUES ('16', 'wp123', 'wp456', '1');

-- ----------------------------
-- Primary Key structure for table T_USER
-- ----------------------------
/*ALTER TABLE CT.T_USER ADD CONSTRAINT "SYS_C0011108" PRIMARY KEY ("USERID");

-- ----------------------------
-- Checks structure for table T_USER
-- ----------------------------
ALTER TABLE CT.T_USER ADD CONSTRAINT "SYS_C0011105" CHECK ("USERNAME" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE CT.T_USER ADD CONSTRAINT "SYS_C0011106" CHECK ("USERPASSWORD" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE CT.T_USER ADD CONSTRAINT "SYS_C0011107" CHECK ("ISADMIN" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;*/


create sequence seq_t_user
    minvalue 1
    maxvalue 99999999
    start with 17
    increment by 1;
-- ----------------------------
-- Triggers structure for table T_USER
-- ----------------------------
CREATE TRIGGER CT.t_user_trig BEFORE INSERT ON CT.T_USER REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW
declare
begin
    select seq_t_user.nextval into :new.userid from dual;
end dept_trig;
/

